package org.jeecg.modules.kc.mapper;

import java.math.BigDecimal;
import java.util.List;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.jeecg.modules.business.entity.BusMarketMealCouponsUsed;
import org.jeecg.modules.kc.entity.KcSupplierInGoods;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;

/**
 * @Description: kc_supplier_in_goods
 * @Author: jeecg-boot
 * @Date:   2023-04-18
 * @Version: V1.0
 */
public interface KcSupplierInGoodsMapper extends BaseMapper<KcSupplierInGoods> {

    /**
     * 供货商品
     * @param page
     * @param hotelId
     * @param goodsName
     * @param goodsTypeId
     * @return
     */
    @Select("<script>select sg.*,g.name as goods_name,cst.name as goods_type_name " +
            "from kc_supplier_in_goods sg inner join ces_goods g on g.id=sg.goods_id\n" +
            "left join ces_stock_type cst on cst.id=g.good_type\n" +
            "where 1=1\n" +
            "<if test='supplierId != null and supplierId !=\"\"'> and sg.supplier_id = #{supplierId} </if>"+
            "<if test='hotelId != null and hotelId !=\"\"'> and sg.hotel_id = #{hotelId} </if>"+
            "<if test='goodsName != null and goodsName !=\"\"'> and g.name like concat('%',#{goodsName},'%') </if>"+
            "<if test='goodsTypeId != null and goodsTypeId !=\"\"'> and cst.id = #{goodsTypeId} </if>"+
            "</script>")
    public List<KcSupplierInGoods> supplierInGoodsList(Page<KcSupplierInGoods> page, String hotelId, String goodsName,String goodsTypeId,String supplierId);
}
